package transaction.lcn.storage.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.springboot.util.MyMapper;
import transaction.lcn.storage.model.StorageTbl;

@Repository
public interface StorageTblMapper extends MyMapper<StorageTbl> {

    @Update("UPDATE storage_tbl SET count = count-#{count} WHERE id=#{id} AND count-#{count}>=0")
    int updateByPrimaryKeyCustom(@Param("id") Integer id, @Param("count") int count);
}